import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hu
 * Date: 2024-05-02
 * Time: 21:57
 */
public class Tesy {
    /* public static int add(int x, int y){
       return x + y;
   }
   public static double add(double x, double y, double z){
       return x + y + z;
   }*/
    //在同一个类中定义多个方法：要求不仅可以求2个整数的最大值，还可以求3个小数的最大值？
    public static int max(int x,int y){
        if(y > x) {
            int tmp = x;
            x = y;
            y = tmp;
        }return x;
    }

    public static double max( double x,double y){
        if(y > x) {
            double tmp = x;
            x = y;
            y = tmp;
        }return x;
    }
    public static double max(double x,double y, double z){
        double ret1 = max(x,y);
        double ret2 = max(ret1,z);
        return ret2;
    }

    public static void main(String[]  args){
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入要比较数字的个数");
        int count = sc.nextInt();
        if(count == 2){
            System.out.println("请输入第一个数");
            int a = sc.nextInt();
            System.out.println("请输入第二个数");
            int b = sc.nextInt();
            int ret2 = max(a, b);
            System.out.println("最大数：" + ret2);
        }else if(count == 3 ) {
            System.out.println("请输入第一个数");
            double a = sc.nextInt();
            System.out.println("请输入第二个数");
            double b = sc.nextInt();
            System.out.println("请输入第三个数");
            double c = sc.nextInt();
            double ret1 = max(a, b, c);
            System.out.println("最大数为：" + ret1);
        }

    }
}
